package com.java.service;

import com.java.instant.MqConst;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RabbitService {

    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     *
     * @param exchange 用到的哪台交换机
     * @param routerKey 匹配的哪个规则
     * @param message 发送数据
     * @return
     */
    public boolean sendMessage(String exchange,String routerKey,Object message){
        rabbitTemplate.convertAndSend(exchange,routerKey,message);
        return true;
    }

}
